package com.bw.zhuangao5___day002.Fragment.Games;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bw.zhuangao5___day002.R;
import com.uuzuche.lib_zxing.activity.CodeUtils;
@Route(path = "/asd/ccc")
public class Games_ErwimaActivity extends AppCompatActivity {

    private ImageView erzi;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_games__erwima);
        initView();
        create();
    }

    private void initView() {
        erzi = findViewById(R.id.erzi);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        finish();
    }

    //生成二维码
    private void create() {
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.dong1);
        Bitmap code = CodeUtils.createImage("杨浩鑫不会的二维码", 400, 400, bitmap);
        erzi.setImageBitmap(code);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus && Build.VERSION.SDK_INT >= 30) {
            View decorView = getWindow().getDecorView();
            decorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
    }
}
